import { defineStore } from "pinia";
import { getCategoryAPI } from "@/apis/layout";
// 导入API

export const useCategoryStore = defineStore("categoryStore", {
  state: () => {
    return {
      categoryData: [],
    };
  },
  actions: {
    async getCategoryData() {
      try {
        const res = await getCategoryAPI();
        this.categoryData = res.result;
      } catch (error) {
        console.warn("抱歉,网络异常");
      }
    },
  },
});
